package user_stub

import (
	"log"
	"net/rpc"
)

type UserStub struct {
	Client *rpc.Client
}

var Stub *UserStub

func InitUserStub(serverAddress string) {

	Stub = &UserStub{Client: RPC_Client(serverAddress)}
}

func RPC_Client(serverAddress string) *rpc.Client {

	client, err := rpc.DialHTTP("tcp", serverAddress+":1234")
	if err != nil {
		log.Fatal("dialing:", err)
	}
	return client
}
